package com.itheima.controller;

import com.itheima.common.Result;
import com.itheima.pojo.Emp;
import com.itheima.service.EmpService;
import org.apache.http.HttpResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 登录控制器
 *
 * @author liudo
 * @version 1.0
 * @project tlias-backend
 * @date 2023/9/12 09:39:31
 */
@RestController
@RequestMapping
public class LoginController {

    @Autowired
    private EmpService empService;

    /**
     * 登录
     *
     * @param emp emp
     * @return {@link Result}<{@link ?}>
     */
    @PostMapping("/login")
    public Result<String> login(@RequestBody Emp emp) {
        String token = empService.login(emp);
        return Result.success(token);
    }
}

